<template>
  <div class="dashboard-container">
    <div class="dashboard-text" style="margin-bottom: 15px;">
      <el-row>
        <el-col :span="7">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">商户名称：</span>
            <el-input v-model="input" placeholder="请输入商户名称" style="width: 70%;" />
          </div>
        </el-col>
        <el-col :span="7">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">物料名称：</span>
            <el-input v-model="input" placeholder="请输入物料名称" style="width: 70%;" />
          </div>
        </el-col>
        <el-col :span="7">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">店铺名称：</span>
            <el-input v-model="input" placeholder="请输入店铺名称" style="width: 73%;" />
          </div>
        </el-col>
        <el-col :span="3" />
      </el-row>
      <el-row>
        <el-col :span="7">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">物料类型：</span>
            <el-select v-model="value" placeholder="请选择物料类型" style="width: 70%;">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
        </el-col>
        <el-col :span="7">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">审核状态：</span>
            <el-select v-model="value" placeholder="请选择审核状态" style="width: 70%;">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
        </el-col>
        <el-col :span="7">
          <div class="demo-input-suffix">
            <span style="font-size: 14px;width: 15%;display: inline-block;">创建时间：</span>
            <el-date-picker
              v-model="time"
              value-format="yyyy/MM/dd HH:mm"
              type="daterange"
              range-separator="至"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              @change="timeChange"
            />
          </div>
        </el-col>
        <el-col :span="3" style="text-align: right;">
          <el-button type="primary" style="width: 45%;">搜索</el-button>
          <el-button style="width: 45%;">重置</el-button>
        </el-col>
      </el-row>
    </div>
    <div class="dashboard-text" style="min-height: 695px;">
      <el-row style="margin-bottom: 15px;line-height: 30px;">
        <el-col :span="12">
          <span style="font-size: 18px;font-weight: bold;">物料列表</span>
        </el-col>
        <el-col :span="12" style="text-align: right;">
          <el-button type="primary" style="width: 13%;">提交审核</el-button>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-table
            :data="tableData"
            border
            style="width: 100%"
          >
            <el-table-column
              type="selection"
              align="center"
              width="55"
            />
            <el-table-column
              prop="date"
              align="center"
              label="ID"
            />
            <el-table-column
              prop="name"
              align="center"
              label="商户名称"
            />
            <el-table-column
              prop="address"
              align="center"
              label="商户ID"
            />
            <el-table-column
              prop="date"
              align="center"
              label="草稿审核状态"
            />
            <el-table-column
              prop="address"
              align="center"
              label="草稿审核失败原因"
            />
            <el-table-column
              prop="address"
              align="center"
              label="物料名称"
            />
            <el-table-column
              prop="address"
              align="center"
              label="物料类型"
            />
            <el-table-column
              prop="name"
              align="center"
              label="创建时间"
            />
            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <el-button type="text" size="small">编辑</el-button>
                <el-button type="text" size="small" @click="handleClick(scope.row)">删除</el-button>
                <el-button type="text" size="small" @click="handleClick(scope.row)">预览</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
      <el-row style="margin: 25px 0 15px;line-height: 26px;text-align: right;">
        <el-col :span="24">
          <div class="block">
            <el-pagination
              :current-page="currentPage4"
              :page-sizes="[100, 200, 300, 400]"
              :page-size="100"
              layout="total, sizes, prev, pager, next, jumper"
              :total="400"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  data() {
    return {
      time: [],
      value1: true,
      currentPage4: 1,
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }],
      input: '',
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value: ''
    }
  },
  methods: {
    handleClick(row) {
      console.log(row)
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    },
    timeChange() {

    }
  },
  computed: {
    ...mapGetters([
      'name'
    ])
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 15px;
  }
  &-text {
    padding: 15px;
    font-size: 30px;
    line-height: 46px;
    background-color: #fff;
  }
}
</style>
